package com.twu.biblioteca;

/**
 * Created by mauricio on 10/2/14.
 */
abstract class Checkable {
    private boolean checked = false;
    private User checkedBy = null;

    public boolean isAvailable() {
        return this.checked == false;
    }

    public boolean devolve() {
        this.checked = false;
        this.checkedBy = null;
        return isAvailable();

    }

    public Boolean checkout() {
        this.checked = true;
        checkedBy = Auth.getLoggedUser();
        return !isAvailable();
    }

    public User checkedBy() {
        return checkedBy;
    }
}
